<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>
<body>

</body>
<script>
        // 要过滤的敏感词
        var arr=["1","3","5","7","9"]
        // 可能要过滤的字符
        var str="0,1,2,3,4,5,6,7,8,9"
        // 遍历要过滤的字符
        for(i=0;i<str.length;i++){
            // console.log(arr[i])
            // 遍历敏感词，拿到每个敏感词
            arr.forEach(function(val){
                // 替换敏感词，并手动赋值给原字符
                str=str.replace(val,"*");
            })
        }
        console.log(str)
</script>
</html>